﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Modules.bandits.transactions {
    import Engine.Transactions.*;
    import Classes.*;
    import Modules.bandits.*;

    public class TUpgradeCatchUp extends Transaction {

        private var m_station:Municipal;
        protected var m_oldItem:Item;
        protected var m_newItem:Item;

        public function TUpgradeCatchUp(_arg1:Municipal){
            var _local3:String;
            super();
            this.m_station = _arg1;
            this.m_oldItem = _arg1.getItem();
            var _local2:int = Math.max(BanditUtil.getPoliceStationLevel(), Global.world.citySim.banditManager.getStationUnlockLevel());
            if (_local2 > 0){
                _local3 = Global.gameSettings.getPoliceStationNameForLevel(_local2);
                this.m_newItem = Global.gameSettings.getItemByName(_local3);
            };
            if (this.m_newItem != null){
                this.m_station.setItem(this.m_newItem);
                this.m_station.setState(this.m_station.getState());
            };
        }
        override public function perform():void{
            signedCall("BanditService.upgradeCatchUp", this.m_station.getId());
        }
        override protected function onFault(_arg1:int, _arg2:String):void{
            super.onFault(_arg1, _arg2);
            this.m_station.setItem(this.m_oldItem);
            this.m_station.setState(this.m_station.getState());
        }

    }
}//package Modules.bandits.transactions 
